<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>$http服务</title>
</head>
<body ng-app="app">
	<div ng-controller="ctrl">
		{{msg}}
	</div>

	<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.7/angular.js"></script>
	<script>
		let app = angular.module("app", []);
		app.controller("ctrl", ($scope, $http) => {
			$http({
				method: "GET",
				url: "data.json",
				//传递参数
				params: {name: "Windea"}
			}).then(function success(response) {
					$scope.msg = response.data.msg;
				}, function error(response) {
					console.log(response.data);
					console.log(response.status)
				}
			);
		});
	</script>
</body>
</html>
